package com.moment.controller;

import java.util.regex.Matcher;
import java.util.regex.Pattern;



public class Passwordvalidator {
	private Pattern pattern;
	 private Matcher matcher;
	 int msg;

		private static final String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})"; 
	
		
		public void PasswordValidator()
	  {
		  pattern = Pattern.compile(PASSWORD_PATTERN);
	  }
	  
	  public boolean validate(final String password)
	  {
		  PasswordValidator();
		  matcher = pattern.matcher(password);
		  if (matcher.matches())
		  {
			  return true;
			
		  }
		  else
		  {
			 
			  return false; 
		  }
	  }
}
